<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/7/26
  Time: 17:19
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>check</title>
</head>
<body>
    <%
        request.setCharacterEncoding("utf-8");
        String name = request.getParameter("uname");
        String pwd = request.getParameter("upwd");
        if(name.equals("Yu") && pwd.equals("123456")){
            //重定向：页面跳转，但数据会丢失；地址栏会发生改变
            //        请求2次，它会将目标页面返回给客户端，客户端再向服务端请求
            //response.sendRedirect("success.jsp");
            //请求转发：页面跳转，数据不会丢失;地址栏没有改变，仍然保留转发时的页面
            //         请求1次，服务端内部直接跳转到目标页面
            request.getRequestDispatcher("success.jsp").forward(request,response);
        }else{
            out.print("用户名或密码有误！");
        }
    %>
</body>
</html>
